package com.beeway.blackgoose.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.beeway.blackgoose.R;
import com.beeway.blackgoose.bean.ListMessage;
import com.beeway.blackgoose.bean.MyStore;
import com.lidroid.xutils.BitmapUtils;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

import java.util.List;

/**
 * @说 明：
 * @项目名称：BlackGoose
 * @包 名： com.beeway.blackgoose.adapter
 * @类 名：
 * @创 建人：chenshuangniu
 * @创建时间：2015 2015/9/19
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */

public class
        StoreListAdapter extends MyBaseAdapter {
    private List<MyStore> list;

    public StoreListAdapter(Context context, List<MyStore> list, BitmapUtils bitmapUtils) {
        super(context, list, bitmapUtils);
        this.list = list;
    }

    @Override
    public View getItemView(int position, View view, ViewGroup parent) {
        ViewHolder vh;
        if (view == null) {
            view = inflate.inflate(R.layout.store_item_layout, null);
            vh = new ViewHolder(view);
            view.setTag(vh);
        } else {
            vh = (ViewHolder) view.getTag();
        }
        MyStore lm = list.get(position);
        String url = lm.getFace();
        vh.company.setText(lm.getCompany());
        vh.address.setText(lm.getAddress());
        //测试
        vh.loction.setText(lm.getLatitude());

        bitmapUtils.display(vh.face, url);
        return view;
    }

    public static class ViewHolder {
        //星星暂时先不做 可能要自定义 同时地址的距离也不写

        @ViewInject(R.id.store_name_tv)
        private TextView company;
        @ViewInject(R.id.store_address_tv)
        private TextView address;
        @ViewInject(R.id.store_loction_tv)
        private TextView loction;
        @ViewInject(R.id.store_loge_img)
        private ImageView face;
        public ViewHolder(View v) {
            ViewUtils.inject(this, v);
        }

    }
}
